<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="css/base/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="css/base/weui.min.css" />
		<link rel="stylesheet" type="text/css" href="css/base/Buttons.css" />
		<link rel="stylesheet" type="text/css" href="css/base/public.css" />
	</head>
	<style type="text/css">
		.personal_centerTop {
			position: fixed;
			top: 0px;
			height: 50px;
			width: 100%;
			display: -webkit-box;
		}
		
		.top_fanhui {
			width: 50px;
			font-size: 20px;
			text-align: center;
			line-height: 50px;
			color: #FFF;
		}
		
		.top_name {
			-webkit-box-flex: 1;
			font-size: 18px;
			line-height: 50px;
			color: #FFF;
		}
		
		.content {
			padding: 50px 0px;
		}
		
		.contentLogo {
			border: 1px solid #ddd;
			height: 35vh;
			width: 100%;
		}
		
		.logo {
			border: 1px solid;
			width: 110px;
			height: 110px;
			border-radius: 110px;
			margin: auto;
			margin-top: 50px;
			line-height: 110px;
			font-size: 100px;
			background-color: #13A311;
			color: #fff;
			text-align: center;
		}
		
		.logoTxt {
			text-align: center;
			margin-top: 10px;
			color: #666;
			font-weight: bolder;
			/*font-size: 12px;*/
		}
		
		.xiaoxiIcon {
			border: 1px solid;
			font-size: 22px;
			border-radius: 50px;
			padding: 0px 7px 0px 7px;
			background-color: #13A311;
			color: white;
		}
		textarea{
			border: 1px solid #D0D0D0;
			width: 300px;
			height: 80px;
			font-size: 12px;
		}
	</style>

	<body>
		<div class="personal_centerTop top_blue">
			<div onclick="location.href='personal.html'" class="top_fanhui Hui-iconfont Hui-iconfont-slider-left"></div>
			<div class="top_name font-weight">报修</div>
		</div>

		<!--内容开始-->
		<div class="content">
			<div class="weui-cells__title">描述故障类型</div>
			
			<div class="weui-cells__title">
				<textarea id="textarea"  name="" rows="" cols=""></textarea>
			</div>
			<form id="uploadForm">
				<div class="weui-cells weui-cells_form">
					<div class="weui-cell">
						<!--<div class="weui-cell__hd"><label class="weui-label">车牌号</label></div>-->
						<div class="weui-cell__bd">
							<input id="number" class="weui-input" type="number" pattern="[0-9]*" placeholder="请输入车牌号">
						</div>
					</div>
					<div class="weui-cell">
						<!--<div class="weui-cell__hd"><label class="weui-label">备注</label></div>-->
						<div class="weui-cell__bd">
							<input id="beizhu" class="weui-input" type="text" placeholder="请输入备注">
						</div>
					</div>
				</div>
			</form>
			<a  class="button button-block button-rounded button-primary button-large submit">提交</a>
		</div>
		<!--内容结束-->
		<!--底部按钮开始-->
		<div class="weui-tabbar footer">
			<a href="index.html" class="weui-tabbar__item ">
				<p style="color: rgba(153,153,153,1);" class="footertab_blue weui-tabbar__label Hui-iconfont Hui-iconfont-saoyisao "></p>
			</a>
			<a href="IM.html " class="weui-tabbar__item ">
				<p class="weui-tabbar__label Hui-iconfont Hui-iconfont-xiaoxi1 "></p>
			</a>
			<a href="personal.html " class="weui-tabbar__item ">
				<p class="footertab_blue weui-tabbar__label Hui-iconfont Hui-iconfont-user "></p>
			</a>
		</div>
		<!--底部按钮结束-->
	</body>
	<script src="js/base/av-min-2.1.2.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/base/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/base/vue.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		window.onload = function() {
			 email = sessionStorage.getItem("email");
			if(sessionStorage.getItem("userName")) {
				var APP_ID = 'hN1kSQf2DQ9awcJmwEmIIdVo-gzGzoHsz';
				var APP_KEY = 'aHCVjhhcyeerTEsKObkGSyd6';
				AV.init({
					appId: APP_ID,
					appKey: APP_KEY
				});

			} else {
				location.href = 'login.html'
			}
		}

		$('.submit').click(function() {
			var textarea=$('#textarea').val()
			var beizhu=$('#beizhu').val()
			var bikeNumber=$('#number').val()
			console.log(email)
			if (textarea==""||beizhu==""||bikeNumber=="") {
				alert("请完整填写报修单！")
			} else{
				// 声明类型
				var User_info = AV.Object.extend('bike_repair');
				// 新建对象
				var User_info = new User_info();
				// 设置邮箱
				User_info.set('email', email);
				// 设置车辆号
				User_info.set('bikeNumber', bikeNumber);
//				 设置消费数据
				User_info.set('faultType', textarea);
//				// 设置消费时间
				User_info.set('beizhu', beizhu);
				// 设置姓名
				User_info.save().then(function(todo) {
					console.log(todo.id)
					alert('报修成功');
				}, function(error) {
					alert('历史记录失败');
				});
			}
			
		})
		
		

	</script>

</html>